	var p;
	//进度条
var LoadingBar=function(){
		this.Container_constructor();
		var self=this;
		this._width=100;
		this._height=20;
		this._lw=1;
		this._progress=0;
		
		var shape0=new cjs.Shape();
		shape0.parent=this;
		this.addChild(shape0);
		
		var shape1=new cjs.Shape();
		shape1.parent=this;
		this.addChild(shape1);
		
		var shape2=new cjs.Shape();
		shape2.parent=this;
		this.addChild(shape2);
		shape1.mask=shape2;
		
		this.setProgress=function(value){
			//console.log(value);
			this._progress=value/100;
			this.update();
		};
		
		this.update=function(){
			shape0.graphics.clear();
			shape0.graphics.beginFill("#fe7b00");
			shape0.graphics.drawRoundRect(0,0,self._width,this._height,this._height/2);
			shape0.graphics.endFill();
			
			shape1.graphics.clear();
			shape1.graphics.beginFill("#ffffff");
			shape1.graphics.drawRoundRect(this._lw,this._lw,self._width-this._lw*2,this._height-this._lw*2,(this._height-this._lw*2)/2);
			shape1.graphics.endFill();
			
			shape2.graphics.clear();
			shape2.graphics.beginFill("rgba(0,0,0,0)");
			shape2.graphics.drawRect(self._width*this._progress,0,self._width*(1-this._progress),this._height);
			shape2.graphics.endFill();
			shape1.mask=shape2;
			
			self.setBounds(self.x, self.y, this._width, this._height);
		};
		this.update();
	};
	p=cjs.extend(LoadingBar,cjs.Container);
	p._get_width=function(){
		return this._width;
	};
	p._set_width=function(value){
		this._width=value;
		this.update();
	};
	p._get_height=function(){
		return this._height;
	};
	p._set_height=function(value){
		this._height=value;
		this.update();
	};
	try{
		Object.defineProperties(p,{
			width:{get:p._get_width,set:p._set_width},
			height:{get:p._get_height,set:p._set_height}
		});
	}catch(e){}
LoadingBar = cjs.promote(LoadingBar, "Container");
//
var SelectCursor=function(){
	this.Sprite_constructor();
	var self=this;

	this.spriteSheet = new createjs.SpriteSheet({framerate:16,images:[images.tankAll],frames:[[128,96,27,27],[128,96+27,27,27]]});
};
p=cjs.extend(SelectCursor,cjs.Sprite);
SelectCursor = cjs.promote(SelectCursor, "Sprite");
//坦克主角
var Tank=function(){
	this.Container_constructor();
	var self=this;
};
p=cjs.extend(Tank,cjs.Container);
Tank = cjs.promote(Tank, "Container");
	//音效控制
var SoundOnoff=function(){
		this.Container_constructor();
		var self=this;
		var b=true;
		
		var img=new cjs.Bitmap(as.properties.images['music_on']);
		img.setTransform(0,28,1,1,0,0,0,28,28);
		img.parent=this;
		this.addChild(img);
		
		this.on('tick',function(e){
			//img.setTransform(0,0,1,1,img.rotation+=0.1);
			img.rotation+=0.5;
		},false,null);
		
		this.on('mousedown',function(e){
			if(b){
				img.image=as.properties.images['music_off'];
				b=false;
				self.dispatchEvent(new cjs.Event('music_off',true));
			}else{
				img.image=as.properties.images['music_on'];
				b=true;
				self.dispatchEvent(new cjs.Event('music_on',true));
			}
			e.stopPropagation();
		},false,null);
	};
p=cjs.extend(SoundOnoff,cjs.Container);
SoundOnoff = cjs.promote(SoundOnoff, "Container");
//单个数
var NumSprite=function(){
	this.Sprite_constructor();
	var self=this;
	//
	let arr=[];
	for(let i=0;i<10;i++){
		arr.push([256+i*14,96,14,14]);
	}
	this.spriteSheet = new cjs.SpriteSheet({images:[images.tankAll],frames:arr});
};
p=cjs.extend(NumSprite,cjs.Sprite);
NumSprite = cjs.promote(NumSprite, "Sprite");
//多位数
var MultiNum=function(){
	this.Container_constructor();
	var self=this,num=0,tempNumArray = [];
	//
	Object.defineProperties(this,{
		value:{
			get:function(){
				return num;
			},
			set:function(value){
				num=value;
				if(num == 0){
					tempNumArray.push(0);
				}else{
					while(num > 0){
						tempNumArray.push(num % 10);
						num = parseInt(num/10);
					}
				}
				self.removeAllChildren();
				for(let i=tempNumArray.length-1;i>=0;i--){
					let mc=new NumSprite();
					mc.gotoAndStop(tempNumArray[i]);
					mc.setTransform((tempNumArray.length-i-1)*14,0);
					mc.parent=self;
					self.addChild(mc);
				}
			}
		}
	});
};
p=cjs.extend(MultiNum,cjs.Container);
MultiNum = cjs.promote(MultiNum, "Container");
//
var LevelLabel=function(value){
	this.Container_constructor();
	var self=this;
	//
	var label=new cjs.Sprite();
	label.spriteSheet=new cjs.SpriteSheet({images:[images.tankAll],frames:[[396,96,78,14]]});
	label.parent=self;
	self.addChild(label);
	//
	var num=new MultiNum();
	num.setTransform(90,0);
	num.parent=self;
	self.addChild(num);
	num.value=value;
};
p=cjs.extend(LevelLabel,cjs.Container);
LevelLabel = cjs.promote(LevelLabel, "Container");
//地图
var Map=function(){
	this.Container_constructor();
	var self=this;
	var shape=new cjs.Shape();
	shape.parent=self;
	self.addChild(shape);
	//
	this.level = 1;
	this.mapLevel = null; 
	//this.wallCtx = wCtx;
	//this.grassCtx = gCtx;
	
	this.offsetX = 32; //主游戏区的X偏移量
	this.offsetY = 16;//主游戏区的Y偏移量
	this.wTileCount = 26; //主游戏区的宽度地图块数
	this.HTileCount = 26;//主游戏区的高度地图块数
	this.tileSize = 16;	//地图块的大小
	this.homeSize = 32; //家图标的大小
	//this.num = new Num(this.wallCtx);
	this.mapWidth = 416;
	this.mapHeight = 416;
	/**************地图块*****************/
var WALL = 1;
var GRID = 2;
var GRASS = 3;
var WATER = 4;
var ICE = 5;
var HOME = 9;
var ANOTHREHOME = 8;

	this.setMapLevel = function(level){
		this.level = level;
		var tempMap = eval("map"+this.level);
		this.mapLevel = new Array();
		for(var i=0;i<tempMap.length;i++){
			this.mapLevel[i] = new Array();
			for(var j=0;j<tempMap[i].length;j++){
				this.mapLevel[i][j] = tempMap[i][j];
			}
			
		}
	};

	this.mapdraw=function(){
		shape.graphics.clear();
		shape.graphics.beginFill("#000");
		shape.graphics.drawRect(0,0,416,416);
		shape.graphics.endFill();

		for(var i=0;i<this.HTileCount;i++){
			for(var j=0;j<this.wTileCount;j++){
				if(this.mapLevel[i][j] == WALL || this.mapLevel[i][j] == GRID || this.mapLevel[i][j] == WATER || this.mapLevel[i][j] == ICE){
					
				}
			}
		}
	}
};
p=cjs.extend(Map,cjs.Container);
Map=cjs.promote(Map,"Container");
//地图块精灵
var TileSprite=function(){
	this.Sprite_constructor();
	var self=this;
	//
	let arr=[];
	for(let i=0;i<5;i++){
		arr.push([i*16,96,16,16]);
	}
	this.spriteSheet = new cjs.SpriteSheet({images:[images.tankAll],frames:arr});
};
p=cjs.extend(TileSprite,cjs.Sprite);
TileSprite = cjs.promote(TileSprite, "Sprite");